﻿// Decompiled with JetBrains decompiler
// Type: MCM.LightInject.EnumerableTypeExtensions
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

#nullable disable
namespace MCM.LightInject
{
  [ExcludeFromCodeCoverage]
  internal static class EnumerableTypeExtensions
  {
    private static readonly ThreadSafeDictionary<Type, Type> EnumerableTypes = new ThreadSafeDictionary<Type, Type>();

    public static Type GetEnumerableType(this Type returnType)
    {
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      return EnumerableTypeExtensions.EnumerableTypes.GetOrAdd(returnType, EnumerableTypeExtensions.\u003C\u003EO.\u003C0\u003E__CreateEnumerableType ?? (EnumerableTypeExtensions.\u003C\u003EO.\u003C0\u003E__CreateEnumerableType = new Func<Type, Type>(EnumerableTypeExtensions.CreateEnumerableType)));
    }

    private static Type CreateEnumerableType(Type type)
    {
      return typeof (IEnumerable<>).MakeGenericType(type);
    }
  }
}
